package com.sharemarking.wa.platform.controller;

import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.platform.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;


@RequestMapping("base")
@RestController
public class CommonController {
    @Autowired
    CommonService commonService;

    /**
     * 获取验证码
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getVailCode")
    public ResponseParams<?> getVailCode() throws Exception {
        return commonService.getVailCode();
    }

    /**
     * 获取系统资源
     *
     * @param
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getSystemResources")
    public ResponseParams<?> getSystemResources() throws Exception {
        return commonService.getSystemResources();
    }

    /**
     * 修改手机号
     *
     * @return
     * @throws Exception
     */
    @PostMapping("updateMobile")
    public ResponseParams<?> updateMobile() throws Exception {
        return commonService.updateMobile();
    }


    /**
     * 通过密码登录
     *
     * @param
     * @return
     * @throws Exception
     */
    @PostMapping("loginByPassword")
    public ResponseParams<?> loginByPassword() throws Exception {
        return commonService.loginByPassword();
    }


    /**
     * 找回密码
     *
     * @return
     * @throws Exception
     */
    @PostMapping("findPsw")
    public ResponseParams<?> findPsw() throws Exception {
        return commonService.findPsw();
    }

    /**
     * 修改密码
     *
     * @return
     * @throws Exception
     */
    @PostMapping("updatePsw")
    public ResponseParams<?> updatePsw() throws Exception {
        return commonService.updatePsw();
    }


    /**
     * 注册并登录
     *
     * @return
     * @throws Exception
     */
    @PostMapping("registerAndLogin")
    @Transactional(rollbackFor = Exception.class)
    public ResponseParams<?> registerAndLogin() throws Exception {
        return commonService.registerAndLogin();
    }


    /**
     * 验证码登录
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = "loginByVailCode")
    public ResponseParams<?> loginByVailCode() throws Exception {
        return commonService.loginByVailCode();
    }


    /**
     * 获取用户信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getMemberInfo")
    public ResponseParams<?> getMemberInfo() throws Exception {
        return commonService.getMemberInfo();
    }


    /**
     * 编辑个人信息
     *
     * @return
     * @throws Exception
     */
    @PostMapping("editMemberInfo")
    public ResponseParams<?> editMemberInfo() throws Exception {
        return commonService.editMemberInfo();
    }


    /**
     * 获取地区列表
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getAreaList")
    public ResponseParams<?> getAreaList() throws Exception {
        return commonService.getAreaList();
    }


    /**
     * 获取通用列表
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getCommonList")
    public ResponseParams<?> getCommonList() throws Exception {
        return commonService.getCommonList();
    }

    /**
     * 获取系统配置信息
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getConfigInfo")
    public ResponseParams<?> getConfigInfo() throws Exception {
        return commonService.getConfigInfo();
    }


    /**
     * 获取版本信息
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getVersionInfo")
    public ResponseParams<?> getVersionInfo() throws Exception {
        return commonService.getVersionInfo();
    }


    /**
     * 获取海报
     * @return
     * @throws Exception
     */
    @GetMapping(value = "getPoster")
    public ResponseParams<?> getPoster() throws Exception {
        return commonService.getPoster();
    }

    /**
     * 分享文章
     * @return
     * @throws Exception
     */
    @GetMapping(value = "getShre")
    public void getShre(int article) throws Exception {
        commonService.getShre(article);
    }


    /**
     * 已经登陆
     * @return
     * @throws Exception
     */
    @GetMapping(value = "isLogin")
    public ResponseParams<?> isLogin() throws Exception {
        return commonService.isLogin();
    }
}
